package com.tencent.wxcloudrun.controller;

import com.tencent.wxcloudrun.controller.utils.ResultResponse;
import com.tencent.wxcloudrun.domain.MealKind;
import com.tencent.wxcloudrun.service.MealKindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/mealkinds")
public class MealKindController {

    @Autowired
    private MealKindService mealKindService;

    @GetMapping
    public ResultResponse list() {
        return ResultResponse.ok(mealKindService.list(),false);
    }

    @GetMapping("/all")
    private ResultResponse ListAll() {
        return ResultResponse.ok(mealKindService.getMealKindList(),false);
    }

    @PostMapping
    public ResultResponse add(@RequestBody MealKind mealKind){
        boolean result = mealKindService.save(mealKind);
        return ResultResponse.ok(result,"新增成功");
    }
}
